$(document).ready(function () {
    var dataSource = new kendo.data.DataSource({
        data: appBosch.data,
        schema: {
            model: {
                fields: {
                    total: {type: 'number'}
                }
            }
        },
        group: [
            {
                field: 'line', aggregates: [
                {
                    field: 'total', aggregate: 'sum'
                }
            ]
            },
            {
                field: 'nomina', aggregates: [
                {
                    field: 'total', aggregate: 'sum'
                }
            ]
            }
        ]
    });

    $("#grid").kendoGrid({
        toolbar: [
            {
                name: "excel",
                text: "Exportar a Excel"
            },
            {
                name: "pdf",
                text: "Exportar a PDF"
            }
        ],
        excel: {
            allPages: true,
            fileName: "Evaluaciones, validaciones y certificaciones.xlsx",
            filterable: true
        },
        pdf: {
            allPages: true,
            fileName: "Evaluaciones, validaciones y certificaciones.pdf"
        },
        resizable: true,
        columnMenu: true,
        scrollable: true,
        filterable: {multi: true},
        selectable: "multiple cell",
        navigatable: true,
        sortable: true,
        allowCopy: true,
        dataSource: dataSource,
        columns: [
            {
                field: "line",
                title: "Línea"
            },
            {
                field: "workstation_config_name",
                title: "Tipo"
            },
            {
                field: "total",
                title: "Total",
                template: "#=kendo.toString(total, 'n0')#",
                groupFooterTemplate: "Total: #=kendo.toString(sum, 'n0')#",
                filterable: {multi: false}
            }
        ]
    });
});